set( CMAKE_SYSTEM_NAME Generic )
set( CMAKE_SYSTEM_PROCESSOR TriCore)

set( CompilerPATH "D:/TASKING" )

set( CMAKE_C_COMPILER "${CompilerPATH}/ctc/bin/cctc.exe" )
set( CMAKE_CXX_COMPILER "${CompilerPATH}/ctc/bin/cctc.exe" )
set( CMAKE_LINKER "${CompilerPATH}/ctc/bin/ltc.exe" )
set( CMAKE_AR "${CompilerPATH}/ctc/bin/artc.exe")

#Support long command line
#https://discourse.cmake.org/t/ninja-command-line-too-long/3086/2
set( CMAKE_C_USE_RESPONSE_FILE_FOR_LIBRARIES 1 )
set( CMAKE_C_USE_RESPONSE_FILE_FOR_INCLUDES 1 )
set( CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1 )

#https://discourse.cmake.org/t/tasking-compiler-linking-error-cctc-e205-don-t-know-what-to-do-with-cmakefiles-sample-rsp/5110
#Cmake generated the *.rsp file always using @ but this is not accepted by tasking compiler. 
#Tasking compiler expects -f instead of @. So, to read *.rsp file add
set( CMAKE_C_RESPONSE_FILE_LINK_FLAG "-f " )
set( CMAKE_C_RESPONSE_FILE_FLAG "-f " )
set( CMAKE_C_OUTPUT_EXTENSION ".o" )
set( CMAKE_START_TEMP_FILE "-f " )

set( CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <FLAGS> <DEFINES> <INCLUDES> -o <OBJECT> <SOURCE>" )
set( CMAKE_C_LINK_EXECUTABLE "'${CMAKE_LINKER}' <OBJECTS> <LINK_LIBRARIES> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> --output=<TARGET>:ELF" )

# search for programs in the build host directories
# search for libraries and headers in the target directories
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
set( CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH )
